<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" class="testClass">
    <input type="button" value="变" onclick="test()">
    <script>
        function test() {
            //获取class为testClass的标签
            var testClass = document.getElementsByClassName("testClass")[0];
            //console.log(testClass.value);
            testClass.value = "hello";
            testClass.type = "button";
        }
    </script>
</body>
</html>